package com.dahua.messagesyncsh.util;

import java.lang.reflect.Field;

public class ObjectUtil {
    public static boolean checkNullField(Object o) {
        if (o == null) {
            return true;
        }

        Class<?> clazz = o.getClass();
        for (Field field : clazz.getDeclaredFields()) {
            field.setAccessible(true); // 确保可以访问私有字段
            try {
                java.lang.Object value = field.get(o);
                if (value == null) {
                    return true;
                }
            } catch (IllegalAccessException e) {
                System.err.println("Cannot access field '" + field.getName() + "': " + e.getMessage());
            }
        }
        return false;
    }
}
